package nothing.dao.hibernate;

import nothing.model.Ingredient;
import nothing.dao.IngredientDao;
import org.appfuse.dao.hibernate.GenericDaoHibernate;

import java.util.List;

public class IngredientDaoHibernate extends GenericDaoHibernate<Ingredient, Long> implements IngredientDao {

    public IngredientDaoHibernate() {
        super(Ingredient.class);
    }

    @SuppressWarnings("unchecked")
    public List findByRecipeName(String name) {
        return getHibernateTemplate().find("from Ingredient i, Recipe r where i.recipe=r and r.name=?", name);
    }
}

